Skip to content

Conversation

@pwnage101
Copy link
Member

@pwnage101 pwnage101 commented May 9, 2025

What does this devcontainer do?

  • Configure zsh as default shell on all platforms and via ssh.
  • Configure terminal scrollback to remember 10k lines instead of 1k.
  • Install/enable sshd for remote Emacs & Vim integration.
  • Create a directory to contain all edx repository clones.
  • Set environment variable(s) needed for Devstack to function.
  • Configure all edx ports and give them human-readable names.
  • Grants this codespace access to the private edx/edx-themes repository.
  • Check out all edx repos used by devstack.
  • Install pyenv and configure virtual environments for every edx repo.
  • Provision core app databases + enterprise databases.

When are the startup scripts run?

  • updateContentCommand.sh - Runs first during container build. Resulting image is cached, so put as many steps in here as possible.
  • postCreateCommand.sh - Runs second during container build. Result is not cached, so every time a developer creates a new container they wait for this to run.
  • postStartCommand.sh - Runs every time the container starts.

Steps to create your own codespace

https://2u-internal.atlassian.net/wiki/spaces/SOL/pages/2003370007/UNOFFICIAL+Devstack+on+Codespaces+Guide#Setup

Notes

Since the image is pre-built and cached, developers should instantly have a new devstack environment with fully cloned repos, functioning pyenv, pre-seeded virtual environments, and all services provisioned including enterprise apps.

VS Code is what does the magic of port forwarding from the container into you local machine's localhost, so http://localhost:18000, etc. still work.

Other PRs

@pwnage101 pwnage101 force-pushed the pwnage101/codespaces-support branch 3 times, most recently from a6345fc to 172f1e6 Compare May 9, 2025 16:24
@pwnage101 pwnage101 requested a review from Copilot May 9, 2025 19:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds initial GitHub Codespaces support for the edX Devstack environment. The changes include updated shell scripts for provisioning and post-start configuration, a welcome message for users, and a complete devcontainer configuration with port forwarding and environment setups.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
provision-set-edx-theme.sh Updated repository URL to HTTPS and adjusted theme directory path using DEVSTACK_WORKSPACE.
.devcontainer/welcome.txt Introduced a custom welcome message with setup and usage instructions for Codespaces.
.devcontainer/updateContentCommand.sh Added a content update script to configure git auth, install pyenv, and set up repositories.
.devcontainer/postStartCommand.sh Added a post-start script to persist and restore SSH keys across container restarts.
.devcontainer/devcontainer.json Configured container customizations, port forwarding, and environment variables for Codespaces.

@pwnage101 pwnage101 force-pushed the pwnage101/codespaces-support branch 3 times, most recently from 0d87117 to c4dfe0a Compare May 9, 2025 23:38
@pwnage101 pwnage101 requested a review from Copilot May 9, 2025 23:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds initial support for GitHub Codespaces by configuring the devcontainer environment for Devstack, setting up various services and tools needed for development.

  • Configures the Codespaces environment with scripts to set up zsh, SSH, pyenv, and more.
  • Updates cloning logic for the edX themes repository with SSH and HTTPS fallback.
  • Introduces several devcontainer configuration files for Codespaces onboarding and runtime operations.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
provision-set-edx-theme.sh Updates cloning logic for the edX themes repo with SSH fallback.
.devcontainer/welcome.txt Provides a welcome message with Codespaces-specific setup info.
.devcontainer/updateContentCommand.sh Automates container setup: clone repos, install pyenv, and configure virtualenvs.
.devcontainer/postStartCommand.sh Implements SSH keys backup and recovery in Codespaces.
.devcontainer/postCreateCommand.sh Sets up GitHub auth for pushing branches and updates the welcome note.
.devcontainer/devcontainer.json Configures Codespaces settings, forwarded ports, and container env vars.

@pwnage101 pwnage101 force-pushed the pwnage101/codespaces-support branch 2 times, most recently from d62a633 to c95b02f Compare May 9, 2025 23:41
@pwnage101 pwnage101 requested a review from Copilot May 9, 2025 23:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces initial GitHub Codespaces support for the devstack environment by configuring various components such as the default shell, port forwarding, and repository setups. Key changes include updating the edX themes clone process, adding several container lifecycle scripts (updateContentCommand, postStartCommand, and postCreateCommand), and defining comprehensive devcontainer settings including forwarded ports and environment variables.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
provision-set-edx-theme.sh Revises repository clone strategy using SSH with an HTTPS fallback and organizes source directories.
.devcontainer/welcome.txt Adds a welcome message with initial setup instructions for codespace users.
.devcontainer/updateContentCommand.sh Implements several automated provisioning steps including switching to zsh, cloning repos via HTTPS initially, and setting up pyenv and virtual environments.
.devcontainer/postStartCommand.sh Provides logic to backup or recover SSH keys between sessions.
.devcontainer/postCreateCommand.sh Finalizes container setup with welcome message overriding and GitHub CLI git auth configuration.
.devcontainer/devcontainer.json Configures container customizations, features, environment variables, commands, and port forwarding.

@pwnage101 pwnage101 force-pushed the pwnage101/codespaces-support branch from c95b02f to d1983c7 Compare May 12, 2025 18:31
@pwnage101 pwnage101 merged commit 57dd0fe into master May 14, 2025
14 checks passed
@pwnage101 pwnage101 deleted the pwnage101/codespaces-support branch May 14, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants